home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ply15dat.zip / ZONAL.PI < prev   
Text File  |  1992-09-20  |  1KB  |  44 lines

  1. // Sample transcendental surface.  This is a zonal harmonic.  This file shows
  2. // a way that a surface that is defined in spherical variables can be
  3. // represented in cartesian coordinates and ray-traced.  The surface itself
  4. // is a sphere modified by an associated Legendre polynomial.
  5. // Polyray input file - Alexander Enzmann
  6. //
  7. // Note: it really doesn't seem to be quite right yet.
  8. //
  9.  
  10. // Set up the camera
  11. viewpoint {
  12.    from <0,2,-5>
  13.    at <0,0,0>
  14.    up <0,1,0>
  15.    angle 30
  16.    resolution 160, 160
  17.    }
  18.  
  19. // Set up background color & lights
  20. background SkyBlue
  21. light <10, 20, -30>
  22. include "..\colors.inc"
  23.  
  24. // Conversion from polar to rectangular (for a left-handed
  25. // coordinate system):
  26. //
  27. //  r     = sqrt(x^2 + y^2 + z^2),
  28. //  theta = atan(y/x),
  29. //  phi   = atan(sqrt(x^2 + y^2)/z)
  30. //
  31. // Surface is:
  32. //   r = 1 + c * LegendreP(3,0,cos(phi))
  33. //   r = 1 + c * 2.5 * cos(phi)^3 - 1.5 * cos(phi)
  34. // For this surface, use c = 0.2
  35.  
  36. // Define a zonal harmonic surface
  37. define phi atan(sqrt(x^2 + z^2)/y)
  38. define r sqrt(x^2 + y^2 + z^2)
  39. object {
  40.    function r - (1 + 0.5 * cos(phi)^3 - 0.3 * cos(phi))
  41.    shiny_red
  42.    bounding_box <-2, -2, -2>, <2, 2, 2>
  43.    }
  44.